//牛客 把字符串转换成整数

#include <string>
#include <ctype.h>
using namespace std;

class Solution {
public:
    int StrToInt(string str) {
        int ret = 0, isplus = 1;
        for(auto ch : str)
        {
            if(isalpha(ch))
                return 0;
            else if(ch == '+' || ch == '-')
                isplus = (ch == '+') ? 1 : -1;
            else if(isdigit(ch))
                ret = ret*10 + ch-'0';
        }
        return isplus*ret;
    }
};